package com.turing.draw.enums;


import lombok.Getter;

public enum TaskStatusEnum {

    UPLOADED(0, "上传完成"),
    PRETASKFINISHED(1, "切割完成"),
    OCRFINISHED(2, "提取完成"),
    DRAWFINISHED(3, "预测完成"),
    FINISHED(4, "完成"),
    FAILED(-1, "任务失败");


    @Getter
    private Integer code;
    @Getter
    private String name;

    TaskStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;

    }

    public static FileStatusEnum getEnum(Integer index) {
        FileStatusEnum[] fileStatusEnums = FileStatusEnum.values();
        for (FileStatusEnum anFileStatusEnum : fileStatusEnums) {
            if (index.equals(anFileStatusEnum.getCode())) {
                return anFileStatusEnum;
            }
        }
        return null;
    }

}
